package com.xyh.flowershop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xyh.flowershop.domain.Cart;
import com.xyh.flowershop.vo.req.cart.CartEditReqVo;
import com.xyh.flowershop.vo.req.cart.CartPageReqVo;
import com.xyh.flowershop.vo.req.cart.UpdateCheckedReqVo;
import com.xyh.flowershop.vo.resp.cart.CartPageRespVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author 10728
* @description 针对表【tb_cart】的数据库操作Mapper
* @createDate 2024-05-04 20:39:59
* @Entity com.xyh.flowershop.domain.Cart
*/
public interface CartMapper extends BaseMapper<Cart> {

    Cart selectByCondition(@Param("vo") CartEditReqVo vo);

    IPage<CartPageRespVo> selectPageCarts(IPage<CartPageRespVo> page, @Param("vo") CartPageReqVo vo);

    int removeCarts(List<String> ids);

    List<CartPageRespVo> selectCartsByIds(@Param("ids") List<String> ids, @Param("userId") String userId);

    int batchInsertCarts(List<Cart> carts);

    void updateCheckedAll(@Param("userId") String userId, @Param("isAllChecked") Boolean isAllChecked);

    @Update("update tb_cart set is_checked = #{isCheck} where id = #{id}")
    void updateChecked(@Param("id") String id, @Param("isCheck") Boolean isCheck);

    int batchUpdateCarts(List<Cart> editCartList);
}




